home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.3
/
Video Toaster v4.3.iso
/
3.1
/
toasterall
/
arexx_examples
/
tpaint
/
tpaintstrybd.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-01-29
|
9KB
|
257 lines
/* TPaintStryBd.rexx -- A ToasterPaint Frame StoryBoarder */
/* By Arnie Cachelin © 1992 NewTek Inc */
/*
This program will take a series of numbered frames (like from LightWave), shrink
them, save the shrunken images to the 'TempPath' specified or RAM:, then place
them on a single frame in 3x3, 4x4, or 5x5 format. It adds a nice little embossed
border for each frame. The final storyboard pictures are saved with the original
frames. If more than one page of frames is specified, more than one storyboard
image will be created.
To use it, type 'rx TPaintStryBd' followed by the directory where the frames will
be found, the base name of the frames (without the 001 part). Optional parameters are
a TempPath, where shrunken frames will be stored (Default=RAM:), the frame size,
either S, M, or L for 3x3 to 5x5 storyboards (Default=M), the number of frames, frame
number to start on, and the frame step (Default=1, draw every frame).
This program contains a large set of useful ARexx-ToasterPaint functions which can
be used in your own programs.
*/
ARG inpath BaseName temppath FrameSize LastFrame Frame FramesToSkip
if inpath="" | basename="" then do
say "USAGE: rx StoryBoard inpath basename [TempPath [FrameSize(S|M|L) [LastFrame [FirstFrame [Step]]]]]"
exit
end
if TempPath="" then TempPath="RAM:"
if frame="" then frame=0
firstframe=frame
if lastframe="" then lastframe=-1
if framesize="" then framesize="M"
if framestoskip="" then framestoskip=1
fwide.L=250
fhigh.L=160
fwide.M=188
fhigh.M=120
fwide.S=148
fhigh.S=92
FramesPerSide.L=3 /* as in 3x3, 4x4, 5x5, etc. we could even add T for tiny -- 6x6 */
FramesPerSide.M=4
FramesPerSide.S=5
PageWide=752
PageHigh=480
Label=0
interpret "fwide=fwide."FrameSize /* Value of framesize selects value of fwide */
interpret "fhigh=fhigh."FrameSize
interpret "FramesPerSide=FramesPerSide."FrameSize
FramesPerPage=FramesPerSide*FramesPerSide
LastFrameNum=LastFrame * FramesToSkip + FirstFrame
say "FramesToSkip="FramesToSkip
say "LastFrameNum="lastframenum
if pos('DigiPaint',show(ports))=0 then do
say "Can't find ToasterPaint!"
exit
end
Address "DigiPaint" /* Tell ARexx where commands go */
'Cbx0' /* Choose color 0 (black) */
'Clrs' /* Clear the screen */
'Maxe' /* Set edge blend level to max */
'Maxc' /* Set center blend level to max */
Pic = getname(temppath,BaseName,Frame)
if ~Exists(temppath||Pic) Then
t=ShrinkFrames(inpath,temppath,BaseName,FirstFrame,LastFrame,FrameSize,BW,FramesToSkip)
'Clrs' /* Clear the screen */
PageHas = 0
Page=1
Do While Exists(temppath||Pic)
LeftEdge = (((PageHas)//(FramesPerSide))*fwide) /* (Frame across // frames wide)*wide */
TopEdge = (((PageHas)%(FramesPerSide))*fhigh) /* frame mod frames high */
t=LoadBrush(temppath,Pic)
'Pend' LeftEdge+fwide%2 TopEdge+fhigh%2
'Penu' LeftEdge+fwide%2 TopEdge+fhigh%2
SAY pic LeftEdge+fwide%2 TopEdge+fhigh%2
PageSaved=0
/* ADDRESS Command "Delete "temppath||pic */
IF bord>0 then t=EmbossBorder(leftedge,topedge,fwide-1,fhigh-1,4)
'Pmcl' /* Normal draw Mode */
PageHas = PageHas +1
if lastframe~=-1 then
if (frame>=LastFrameNum) then break
If PageHas = FramesPerPage then Do
t=SaveRGB(inpath,basename||".strybd"||FrameSize||Page)
PageSaved=1
Page=Page+1
PageHas = 0
'Clrs' /* Clear the screen */
End
Frame = Frame + FramesToSkip
Pic = getname(temppath,BaseName,Frame)
end
If PageSaved = 0 then t=SaveRGB(inpath,basename||".strybd"||FrameSize||Page)
'Shco' /* Render canvas to composite output */
exit
CutBrush: PROCEDURE /* Cut out a brush with corners at (x1,y1) and (x2,y2) */
arg x1, y1, x2, y2
'Dotb' /* smallest brush size */
'Drre' /* Rectangle mode */
'Scis' /* Scissors on, for cutting a brush */
'Pend' x1 y1 /* Get in top Left corner */
'Penu' x2 y2 /* lift pen to get brush! */
return 0
MapBrush: PROCEDURE /* Size swap brush into rectangle with corners at (x1,y1) and (x2,y2) */
arg x1, y1, x2, y2 /* if there is no swap brush, whole screen is used! */
'Flon' /* Fill On */
'Maxc' /* Set center transparency off */
'Maxe' /* Set edge transparency off */
'Aaon' /* Anti-alias on */
'Txma' /* Texture mapping on, fill on, draw rectangles */
'Drre' /* Draw Rectangles */
'Pend' x1 y1 /* Get in top Left corner */
'Penu' x2 y2 /* lift pen */
'Flof' /* fill off */
'Pmcl' /* Normal draw Mode */
return 0
MapScreen: PROCEDURE /* Size full screen into rectangle with corners at (x1,y1) and (x2,y2) */
arg x1, y1, x2, y2 /* rectangle is drawn on swap screen */
'Pmcl' /* Normal draw Mode */
'Maxc' /* Set center transparency off */
'Maxe' /* Set edge transparency off */
'Flon' /* Fill On */
'Bdel' /* Delete swap brush */
'Dotb' /* Delete any current cut-out brush */
'Drre' /* Draw Rectangles */
'Swap' /* Jump to (blank) swap screen! */
'Pend' x1 y1 /* Get in top Left corner */
'Penu' x2 y2 /* Lift pen at bottom right */
'Undo' /* Un-draw solid rectangle */
'Rubi' /* Internal Rub-Thru on... use picture in swap screen as source */
'Txma' /* Texture mapping on, since there is no brush, it will use whole screen */
'Redo' /* Re-draw rectangle, this time with texture map of swap screen */
'Flof' /* Fill off */
'Pmcl' /* Normal draw Mode */
return 0
LoadRGB: PROCEDURE /* Load Picture */
arg dirname, filename
'Lo24' /* Call file requester */
'Dnam'dirname /* Enter file path */
'Dsel' /* Hit return on directory */
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return 0
SaveRGB: PROCEDURE /* Save Picture */
arg dirname, filename
'Sa24' /* Call file requester */
'Dnam'dirname /* Enter file path */
'Dsel' /* Hit return on directory */
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return 0
LoadBrush: PROCEDURE /* Load Brush */
arg dirname, filename
'Lobr' /* Call file requester */
'Dnam'dirname /* Enter file path */
'Dsel' /* Hit return on directory */
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return 0
SaveBrush: PROCEDURE /* Save Brush */
arg dirname, filename
'Sabr' /* Call file requester */
'Dnam'dirname /* Enter file path */
'Dsel' /* Hit return on directory */
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return 0
LoadFrameStore: PROCEDURE /* Load FrameStore */
arg filename /* must have ###.fs on front! */
'Loco' /* Call file requester */
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return 0
SaveFrameStore: PROCEDURE /* Save FrameStore */
arg filename /* must have ###.fs on front! */
'Saco' /* Call file requester */
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return 0
ShrinkFrames: PROCEDURE EXPOSE Host fwide. fhigh.
arg inpath, outpath, BaseName, Frame, LastFrame, FrameSize, BW, FramesToSkip
LastFrameNum=LastFrame * FramesToSkip
Pic = getname(inpath,BaseName,Frame)
say pic
Do While Exists(inpath||Pic)
t=LoadRGB(inpath,pic)
say pic
say FrameSize fwide.FrameSize fhigh.FrameSize
'Swap' /* jump to swap screen! */
'Cbx0' /* Pick color zero to clear */
'Clrs' /* Clear screen */
'Swap' /* jump to picture screen! */
t=MapScreen(0,0,fwide.FrameSize, fhigh.FrameSize)
t=CutBrush(0,0,fwide.FrameSize, fhigh.FrameSize)
t=SaveBrush(outpath,pic)
if lastframe~=-1 then
if (frame>=LastFrameNum) then return 0
Frame = Frame+FramesToSkip
Pic = getname(inpath,BaseName,Frame)
End
return 1
Rectangle: PROCEDURE
arg x,y,w,h
'Drre'
'Dotb'
'Pend' x y
'Penu' x+w y+h
return 0
Line: PROCEDURE
arg x,y,x2,y2
'Bsmo' /* Connect the dots drawing */
'Pend' x y
'Penu' x2 y2
return 0
EmbossBorder: PROCEDURE
arg x, y, Width, Height, Thick
'Pmcl' /* Normal paint mode */
'Dotb' /* One pixel brush */
'Bsmo' /* Smooth Draw Mode */
do i=0 to thick
x1=x+i
y1=y+i
x2=x+Width-i
y2=y+Height-i
'Pmln' /* Lighten Mode */
'Pend' x2 y1 /* top */
'Move' x1 y1
'Move' x1 y2
'Penu' x1 y2 /* Left */
'Pmdn' /* Darken Mode */
'Pend' x2 y1 /* Right */
'Move' x2 y2
'Move' x1 y2
'Penu' x1 y2 /* Bottom */
end i
'Pmcl' /* Normal paint mode */
return 1
GetName: PROCEDURE /* stripped down version for Toaster frames with ALWAYS 3 digits */
arg path, name, number
return (strip(name)||right(strip(number),3,"0"))